# !/usr/bin/env python
# coding=utf-8
# @Time    : 2018/8/6 9:26
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/rpc_dao.git
# @File    : user_dao.py
# @Software: PyCharm
# @Version: 2.7.5
from . import Session
from db.models import TUserprofile
from py3_utils import my_sqlalchemy


def add_user(user_profile):
	return my_sqlalchemy.common_insert(Session(), user_profile, TUserprofile)


def update_user(user_profile):
	return my_sqlalchemy.common_update(Session(), user_profile, TUserprofile)


def get_user_by_mobile(mobile):
	session = Session()
	return session.query(TUserprofile).filter_by(mobile=mobile).first()
